﻿ {extends file="profile/layout.tpl"}
 {block name="title"}##NA_RESEARCH##{/block}
 {block name="script"}
 
  $(document).ready(function () {
	
	 $('#fromDate').datepicker({
     showOn: "focus",
       yearRange: "-80:+0",
	   changeMonth: true,
	   changeYear: true,
	   dateFormat: "mm-yy"
    });
	$('#toDate').datepicker({
     showOn: "focus",
       yearRange: "-80:+0",
	   changeMonth: true,
	   changeYear: true,
	   dateFormat: "mm-yy"
    });
	 $('table#research_projects td a.delete').click(function()
    {
        if (confirm("Are you sure you want to delete this row?"))
        {
            var id = $(this).parent().parent().attr('id');
            var data = 'id=' + id ;
            var url = '4_1.php?'+data+'&action=delete';
			window.location.href = url;
        }
    });
	$("#frm4_1").validate({
            rules: {
                project_name_vi: {
                    required: true
                },
				main_org_vi: {
                    required: true
                },
				role_vi: {
                    required: true
                },
				fromDate: {
                    required: true
                }
            },
            messages: {

                project_name_vi: {
                    required: '##EM_PROJECTNAME_IS_REQUIRED##'
                },
				main_org_vi: {
                    required: '##EM_MAINORG_IS_REQUIRED##'
                },
				role_vi: {
                    required: '##EM_ROLE_IS_REQUIRED##'
                },
				fromDate: {
                    required: '##EM_FROMDATE_IS_REQUIRED##'
                }
            }
			});
	});
{/block}
{block name="name"}
    2.##NG_RESEARCH##
{/block}
{block name="content"}
   

    <div class="message {$type_message|default:'error'}" style="display:{$is_display|default:'none'};">{$message|default:''}</div>
    <div class="clear">
        </div>	
 
	
    <div class="box round first center">
        <h2>##NG_PROJECT##</h2>
        <table class="data display datatable" id="research_projects" name="research_projects">
            <thead>
                <tr>
                    <td bgcolor="#FFFFFF"><div align="center"><strong>
                         #
                    </strong></div></td>
                    <td bgcolor="#FFFFFF"><strong>
                        ##NG_PROJECT_NAME##
                    </strong></td>
                    <td bgcolor="#FFFFFF"><strong>
                        ##NG_SPONSOR##
                    </strong></td>
                    <td bgcolor="#FFFFFF"><strong>
                        ##NG_TIME##
                    </strong></td>
                    <td bgcolor="#FFFFFF"><strong>
                        ##NG_ROLE##
                    </strong></td>
                    <td bgcolor="#FFFFFF" align="center"></td>
                    <td bgcolor="#FFFFFF" align="center"></td>
                </tr>
            </thead>
            
            <tbody>
            {foreach $projects|default:array() as $i}
                        
                {if $i@index is div by 2}
                    <tr class="even" id="{$i.Ma}">
                {else}
                    <tr class="odd" id="{$i.Ma}">
                {/if}
                    <td><div align="center">
                            {$i@index + 1}
                    </div></td>
                    <td>
                        {$i.TenDeTai_vi}
                    </td>
                    <td>
                        {$i.TenToChucTaiTro_vi}
                    </td>
                    <td>
                        {$i.ThoiGianBatDau|date_format:"%m-%Y"} - {$i.ThoiGianKetThuc|date_format:"%m-%Y"}
                    </td>
                    <td>
                        {$i.VaiTro_vi}
                    </td>
                    <td align="center"><a href="4_1.php?id={$i.Ma}&action=edit">##NG_EDIT##</a></td>
                    <td align="center"><a href="" class="delete">##NG_DELETE##</a></td>
                </tr>            
                    
               
            {/foreach}
            </tbody> 
        </table>
    </div>
	

    <div class="box round first center">
        <h2>##NG_ADDITION_RESEARCH_INFO##</h2>
    <form id="frm4_1" name="frm4_1" action="4_1.php" method="post">
 
    <table class="data display datatable" cellpadding="10" cellspacing="10" 
        align="left" border="2">
        <tbody>
			<tr>
				<td style="vertical-align:middle"><strong>##NG_PROJECT_NAME##</strong></td>
				<input type="hidden" name="id" id="id" value="{$id}"/>
				<td>
					<table>
						<tr>
							<td style="vertical-align:middle">##NG_VIETNAMESE##</td>
							<td>
								<textarea rows="4" cols="50" id="project_name_vi" name="project_name_vi">{$project_name_vi|default:''}</textarea>(*)
							</td>
						</tr>
						<tr>
							<td style="vertical-align:middle">##NG_ENGLISH##</td>
							<td>
								<textarea rows="4" cols="50" id="project_name_en" name="project_name_en" value="{$project_name_en|default:''}">{$project_name_en|default:''}</textarea>
							</td>
						</tr>
					</table>
				</td>
			</tr>
			
			<tr>
                <td colspan="2"><strong>##NG_SPONSOR##:</strong></td>
            </tr>
			<tr>
				<td align="right"><strong>##NG_EMPLOYER##:</strong></td>
                <td>
                    <table>
                    <tr>
                    <td>
                    ##NG_VIETNAMESE##:
                    </td>
                    <td>
                    <input id="main_org_vi" type="text" value="{$main_org_vi|default:''}" maxlength="100" size="50" name="main_org_vi"/>(*)
                    </td>
                    </tr>
                    <tr>
                    <td>
                    ##NG_ENGLISH##:
                    </td>
                    <td>
                    <input id="main_org_en" type="text" value="{$main_org_en|default:''}" maxlength="100" size="50" name="main_org_en"/>
                    </td>
                    </tr>
                    </table>
                </td>
			</tr>
			
			<tr>
				<td align="right"><strong>##NG_ADDRESS##:</strong></td>
                <td>
                   <input id="address" type="text" value="{$address|default:''}" maxlength="100" size="50" name="address"/>
                </td>
			</tr>
			
			<tr>
				<td align="right"><strong>##NG_WEBSITE##:</strong></td>
                <td>
                   <input id="website" type="text" value="{$website|default:''}" maxlength="100" size="50" name="website"/>
                </td>
			</tr>
			
			<tr>
				<td align="right"><strong>##NG_ROLE##:</strong></td>
                <td>
                    <table>
                    <tr>
                    <td>
                    ##NG_VIETNAMESE##:
                    </td>
                    <td>
                    <input id="role_vi" type="text" value="{$role_vi|default:''}" maxlength="45" size="50" name="role_vi"/>(*)
                    </td>
                    </tr>
                    <tr>
                    <td>
                    ##NG_ENGLISH##:
                    </td>
                    <td>
                    <input id="role_en" type="text" value="{$role_en|default:''}" maxlength="45" size="50" name="role_en"/>
                    </td>
                    </tr>
                    </table>
                </td>
			</tr>
			
			<tr>
				<td colspan="2"><strong>##NG_TIME##:</strong></td>
			</tr>
			<tr>
				<td align="right">##NG_FROMDATE##:</td>
				<td>
					<input type="text" id="fromDate" name="fromDate" value="{$fromDate|default:''|date_format:'%m-%Y'}"/>(mm-yyyy)(*)
				</td>
			</tr>
			<tr>
				<td align="right">##NG_TODATE##:</td>
				<td>
					<input type="text" id="toDate" name="toDate" value="{$toDate|default:''|date_format:'%m-%Y'}"/>(mm-yyyy)
				</td>
			</tr>
			
			<tr>
				<td><strong>##NG_FUND##:</strong></td>
				<td>
					<input type="text" id="fund" name="fund" value="{$fund|default:''}"/>
					<select id="currency" name="currency">
						{foreach $currency_array as $i}
							<option value="{$i}" {if $i == $currency|default:'VND'}selected{/if}>{$i}</option>
						{/foreach}
					</select>
				</td>
			</tr>
			
            <tr>
				<td style="vertical-align:middle"><strong>##NG_MORE_INFO##:</strong></td>
				<td>
					<textarea rows="4" cols="50" id="more_info" name="more_info" value="">{$more_info|default:''}</textarea>
				</td>
			</tr>
			
            <tr>
                <td colspan="2">
                    <div style="float:left; height:auto">
                        <input type="submit" value="##NG_SAVE##" name="save" class="btn btn-blue"/>
                    </div>
                    <div style="float:right; height:auto">
                        <input type="button" value="##NG_NEXT##" name="next" onclick="window.location.href='4.php'" class="btn btn-blue" />
                    </div>
                </td>
            </tr>

        </tbody>
    </table>
    </form>
    </div>
    <div class="clear">
        </div>
{/block}
